from django.contrib import admin
from django.contrib.auth.models import User
from django.contrib.auth.admin import UserAdmin
from .models import UserProfile, EmailVerifyRecord

# 取消关联注册User
admin.site.unregister(User)


# 定义关联对象的样式，StackedInline为纵向排列每一行, TabularInline并排排列
class UserProfileInline(admin.StackedInline):
    model = UserProfile


# 关联UserProfile
class UserProfileAdmin(UserAdmin):
    inlines = [UserProfileInline]


# 注册User模型
admin.site.register(User, UserProfileAdmin)


@admin.register(EmailVerifyRecord)
class Admin(admin.ModelAdmin):
    list_display = ('code', )


# 取消关联注册User
admin.site.unregister(User)


# 定义关联对象的样式，StackedInline为纵向排列每一行, TabularInline并排排列
class UserProfileInline(admin.StackedInline):
    model = UserProfile


# 关联UserProfile
class UserProfileAdmin(UserAdmin):
    inlines = [UserProfileInline]


# 注册User模型
admin.site.register(User, UserProfileAdmin)

